﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using StructureMap;
using StructureMap.Configuration.DSL;
using HR.ProjectX.DAL.UnitOfWork;
using HR.ProjectX.DAL.Repositories;
using HR.ProjectX.BLL.Services.CustomerService;
using HR.ProjectX.BLL.Services.VehicleCategoryService;
using HR.ProjectX.BLL.Services.VehicleService;
using HR.ProjectX.BLL.Services.BookingService;
using HR.ProjectX.BLL.Services.ManufacturerService;

namespace HR.ProjectX.GUI
{
    public class BootStrapper
    {
        public static void ConfigureDependencies()
        {

            ObjectFactory.Initialize(x =>
            {
                x.AddRegistry<ControllerRegistry>();
            });

        }

        public class ControllerRegistry : Registry
        {
            public ControllerRegistry()
            {
                For<IUnitOfWork>().Use<NHUnitOfWork>();

                For<ICustomerRepository>().Use<CustomerRepository>();
                For<ICustomerService>().Use<CustomerService>();

                For<IVehicleCategoryService>().Use<VehicleCategoryService>();
                For<IVehicleCategoryRepository>().Use<VehicleCategoryRepository>();

                For<IVehicleService>().Use<VehicleService>();
                For<IVehicleRepository>().Use<VehicleRepository>();

                For<IBookingService>().Use<BookingService>();
                For<IBookingRepository>().Use<BookingRepository>();

                For<IManufacturerService>().Use<ManufacturerService>();
                For<IManufacturerRepository>().Use<ManufacturerRepository>();
            }
        }
    }
}